'use strict';

/**
 * @param {Egg.Application} app - egg application
 */
module.exports = app => {
    const { router, controller , jwt} = app;
    router.get('/', controller.home.index);
    router.get('/test', controller.login.test)
    router.post('/loginV2', controller.login.loginV2)
    router.post('/sendMsg', controller.login.sendMsg)
    router.post('/business/list',jwt, controller.business.businessList)
    router.post('/business/detail',jwt, controller.business.businessDetail)
    router.post('/active/list',jwt, controller.business.activeList)
    router.post('/active/detail',jwt, controller.business.activeDetail)
    router.post('/news/list',jwt, controller.business.newsList)
    router.post('/news/detail',jwt, controller.business.newsDetail)
    router.post('/info/insert',jwt, controller.business.businessInsert)
    router.post('/index/info', controller.business.indexInfo)
    router.post('/concat/info',jwt, controller.business.concatInfo)
    

    // 后台管理系统
    router.post('/login/manage', controller.login.loginManage)
    router.post('/upload/image', controller.login.uploadImage)
    router.post('/manage/index',jwt, controller.manage.manageIndex)
    router.post('/manage/concat',jwt, controller.manage.manageConcat)
    router.post('/active/get',jwt, controller.manage.activeGet)
    router.post('/active/delete',jwt, controller.manage.activeDelete)
    router.post('/active/add',jwt, controller.manage.activeAdd)
    router.post('/active/update',jwt, controller.manage.activeUpdate)
    router.post('/bussiness/get',jwt, controller.manage.bussinessGet)
    router.post('/upload/edit', controller.login.uploadEdit)
    router.post('/uni/get',jwt, controller.manage.uniGet)
    router.post('/uni/add',jwt, controller.manage.uniAdd)
    router.post('/uni/update',jwt, controller.manage.uniUpdate)
    router.post('/uni/delete',jwt, controller.manage.uniDelete)

    // 券               

    router.post('/get/card',jwt, controller.business.getCard)
    router.post('/card/list',jwt, controller.business.cardList)
    router.post('/use/card',jwt, controller.business.useCard)
    router.post('/card/delete',jwt, controller.business.cardDelete)
    router.post('/card/visit',jwt, controller.business.cardVisit)
    // 小程序相关
    router.post('/wxlogin', controller.login.wxlogin)
    router.post('/wxget/tel', controller.login.wxgetTel)
    // 高校名称模糊查询
    router.post('/get/school/name', controller.login.getSchoolName)
    // 获取入驻学校列表
    router.post('/get/school/enter', controller.login.getSchoolEnter)

    //  --------------U选商家V2 ------------
    router.post('/u/type',jwt, controller.uBusiness.uType)
    router.post('/u/subType',jwt, controller.uBusiness.uSubType)
    router.post('/u/top/business',jwt, controller.uBusiness.uTopBusiness)
    router.post('/u/filter/business',jwt, controller.uBusiness.uFilterBusiness)
    router.post('/u/business/detail', jwt,controller.uBusiness.uBusinessDetail)
    router.post('/u/add/order',jwt, controller.uBusiness.uAddOrder)
    router.post('/u/order/info',jwt, controller.uBusiness.uOrderInfo)
    router.post('/u/pay',jwt, controller.uBusiness.uPay)
    router.post('/u/pay/timeout',jwt, controller.uBusiness.uPayTimeout)
    router.post('/notifyUrl', controller.uBusiness.notifyUrl)
    router.post('/u/update/orderStatus',jwt, controller.uBusiness.uUpdateOrderStatus)
    router.post('/u/orderList',jwt, controller.uBusiness.uOrderList)
    router.get('/qrcode', controller.uBusiness.qrcode)
    router.post('/u/deleteOrder',jwt, controller.uBusiness.uDeleteOrder)

    // -----------------u选商家管理后台-------------------
    // U选商家账号管理
    router.post('/u/schoolManageList',jwt, controller.uBusinessManage.uSchoolManageList)
    router.post('/u/schoolManageAdd',jwt, controller.uBusinessManage.uSchoolManageAdd)
    router.post('/u/schoolManageDelete',jwt, controller.uBusinessManage.uSchoolManageDelete)
    router.post('/u/schoolManageUpdate',jwt, controller.uBusinessManage.uSchoolManageUpdate)

    // U选商家校园入驻
    router.post('/u/schoolList',jwt, controller.uBusinessManage.uSchoolList)
    router.post('/u/schoolAdd',jwt, controller.uBusinessManage.uSchoolAdd)
    router.post('/u/schoolDelete',jwt, controller.uBusinessManage.uSchoolDelete)
    router.post('/u/schoolUpdate',jwt, controller.uBusinessManage.uSchoolUpdate)

    // U选商家商铺管理
    router.post('/u/businessManage/add',jwt, controller.uBusinessManage.uBusinessManageAdd)
    router.post('/u/businessManage/list',jwt, controller.uBusinessManage.uBusinessManageList)
    router.post('/u/businessManage/delete',jwt, controller.uBusinessManage.uBusinessManageDelete)
    router.post('/u/businessManage/update',jwt, controller.uBusinessManage.uBusinessManageUpdate)
    router.post('/u/businessManage/ground',jwt, controller.uBusinessManage.uBusinessManageGround)
    router.post('/u/businessManage/ord',jwt, controller.uBusinessManage.uBusinessManageOrd)
    router.post('/u/businessEnterTop',jwt, controller.uBusinessManage.uBusinessEnterTop)

    // U选商家套餐管理
    router.post('/u/ticket/add',jwt, controller.uBusinessManage.uTicketAdd)
    router.post('/u/ticket/list',jwt, controller.uBusinessManage.uTicketList)
    router.post('/u/ticket/delete',jwt, controller.uBusinessManage.uTicketDelete)
    router.post('/u/ticket/update',jwt, controller.uBusinessManage.uTicketUpdate)

    // 商铺类型列表
    router.post('/uTypeList',jwt, controller.uBusinessManage.uTypeList)
    // 爆款区列表
    router.post('/uTopList',jwt, controller.uBusinessManage.uTopList)

    // 商铺--订单列表
    router.post('/u/orderManage/list',jwt, controller.uBusinessManage.uOrderManageList)
    // 退款
    router.post('/uOrderToPay',jwt, controller.uBusinessManage.uOrderToPay)
    

    // U选商家爆款区
    router.post('/topAreaList',jwt, controller.uBusinessManage.topAreaList)
    router.post('/topAreaAdd',jwt, controller.uBusinessManage.topAreaAdd)
    router.post('/topAreaDelete',jwt, controller.uBusinessManage.topAreaDelete)
    router.post('/topAreaUpdate',jwt, controller.uBusinessManage.topAreaUpdate)

    // 校园管理员--订单列表
    router.post('/u/orderBus/list',jwt, controller.uBusinessManage.uOrderBusList)
    // 校园管理员--订单列表（超时）
    router.post('/u/orderBus/list/timeout',jwt, controller.uBusinessManage.uOrderBusListTimeout)
    // h5验券
    router.post('/vertifyTicket',jwt, controller.uBusinessManage.vertifyTicket)

    // 根据券码查询订单状态
    router.post('/ticketStatus',jwt, controller.uBusiness.ticketStatus)

    // 校园管理者人工分账订单列表
    router.post('/uOrderCheck',jwt, controller.uBusinessManage.uOrderCheck)
    // 核算订单
    router.post('/uOrderCheckUptate',jwt, controller.uBusinessManage.uOrderCheckUptate)
    
    // 商家人工分账订单列表
    router.post('/uOrderCheckManage',jwt, controller.uBusinessManage.uOrderCheckManage)
    
    // 小程序版本
    router.post('/version', controller.uBusinessManage.version)

    // 后台管理系统  切换小程序版本
    router.post('/versionUpdate', jwt, controller.uBusinessManage.versionUpdate)
    

    // 添加分账接收方
    router.post('/addReciver', controller.uBusinessManage.addReciver)

    // 分账
    router.post('/handleAccount',jwt, controller.uBusinessManage.handleAccount)

    router.post('/handleAccountResult',jwt, controller.uBusinessManage.handleAccountResult)


    /* 新生专区模块 */ 
    // 新生专区类型列表
    router.post('/nsTypeList',jwt, controller.newStudent.nsTypeList)
    // 新生专区增删改
    router.post('/nsBusinessList',jwt, controller.newStudent.nsBusinessList)
    router.post('/nsBusinessManageList',jwt, controller.newStudent.nsBusinessManageList)
    router.post('/nsBusinessAdd',jwt, controller.newStudent.nsBusinessAdd)
    router.post('/nsBusinessEdit',jwt, controller.newStudent.nsBusinessEdit)
    // 小程序端 -- 列表详情
    router.post('/nsBusinessDetail',jwt, controller.newStudent.nsBusinessDetail)
    // 电话卡介绍
    router.post('/nsTelText',jwt, controller.newStudent.nsTelText)
    // 统一下单
    router.post('/nsAddOrder',jwt, controller.newStudent.nsAddOrder)
    // 支付
    router.post('/nsPay',jwt, controller.newStudent.nsPay)
    // 根据prepay_id查询订单详情
    router.post('/nsOrderPrepay',jwt, controller.newStudent.nsOrderPrepay)
    // 删除订单
    router.post('/nsDeleteOrder',jwt, controller.newStudent.nsDeleteOrder)
    // 新生专区电话号码模糊搜索
    router.post('/nsTelList',jwt, controller.newStudent.nsTelList)
    // 小程序端--订单列表
    router.post('/nsOrderList',jwt, controller.newStudent.nsOrderList)
    // h5端 查询状态
    router.post('/nsTicketStatus',jwt, controller.newStudent.nsTicketStatus)
    // h5端 验券
    router.post('/nsVertifyTicket',jwt, controller.newStudent.nsVertifyTicket)
    // 后台订单列表
    router.post('/nsOrderManageList',jwt, controller.newStudent.nsOrderManageList)
    // 电话卡资费管理
    // 列表
    router.post('/nsTelTextList',jwt, controller.newStudent.nsTelTextList)
    // 编辑
    router.post('/nsTelTextEdit',jwt, controller.newStudent.nsTelTextEdit)
    // 新增
    router.post('/nsTelTextAdd',jwt, controller.newStudent.nsTelTextAdd)
    // 临时分账
    // router.post('/handleAccountOne', controller.uBusinessManage.handleAccountOne)
    // lh模块
    router.post('/lhColumnList', controller.newStudent.lhColumnList)
    router.post('/lhPayAdd', controller.newStudent.lhPayAdd)
    router.post('/lhPayEdit', controller.newStudent.lhPayEdit)
    router.post('/lhPayList', controller.newStudent.lhPayList)
    router.post('/lhPayDelete', controller.newStudent.lhPayDelete)
    router.post('/lhSummaryChart', controller.newStudent.lhSummaryChart)
    router.post('/lhTest', controller.newStudent.lhTest)


    // ---- 校园论坛--小程序 ----
    // 获取推荐列表
    router.post('/scAticleTop',jwt, controller.scArticle.scAticleTop)
    // 获取发现--栏目列表
    router.post('/scAticleType',jwt, controller.scArticle.scAticleType)
     // 获取发现--发现列表
     router.post('/scAticleFind',jwt, controller.scArticle.scAticleFind)
}